import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.Arrays;

public class 前缀和 {
    static int[][] arr = new int[10][10];
   static int[][] s = new int[1010][1010];
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        PrintStream out = new PrintStream(System.out);
        String[] str = in.readLine().split(" ");
        int n = Integer.parseInt(str[0]);
        int m = Integer.parseInt(str[1]);
        int q = Integer.parseInt(str[2]);
        //
        for(int i=1;i<=n;i++) {
            String[] str1 = in.readLine().split(" ");
            for (int j = 1; j <= m; j++) {
                arr[i][j] = Integer.parseInt(str1[j-1]);
                //构造前缀和矩阵
               // s[i][j] = s[i-1][j]+s[i][j-1]-s[i-1][j-1]+arr[i][j];
            }
        }
        System.out.println(Arrays.deepToString(arr));

        while(q-- >0) {
            String[] str2 = in.readLine().split(" ");
            int x1 = Integer.parseInt(str2[0]);
            int y1 = Integer.parseInt(str2[1]);
            int x2 = Integer.parseInt(str2[2]);
            int y2 = Integer.parseInt(str2[3]);
            System.out.println(x1+" "+y1+" "+x2+" "+y2);
          /*  int end = s[x2][y2]-s[x2][y1-1]-s[x1-1][y2]+s[x1-1][y1-1];
            System.out.println(end);*/
        }


    }
}
